package com.ysd.lis.controller.qc;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.qc.QcRule;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.qc.QcRuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2023-10-19
 */
@Api(tags = "指控规则")
@RestController
@RequestMapping("/api/qc/qcRule")
public class QcRuleController extends BaseController {

    @Autowired
    QcRuleService qcRuleService;
    @ApiOperation("分页查询")
    @GetMapping("/findRulePageList")
    public Result findRulePageList(CommonPageDto pageParam){
        return qcRuleService.findRulePageList(pageParam);
    }

    @ApiOperation("查询")
    @GetMapping("/findQcRuleList")
    public Result findQcRuleList(CommonPageDto pageParam){
        return qcRuleService.findQcRuleList(pageParam);
    }

    @ApiOperation("新增")
    @PostMapping("/addRule")
    @LogDetail(requestParam ="addRule",operationType = OperationType.INSERT, module = "质控规则",content = "通过质控规则模块，增加【name】规则", businessName = "name")
    public Result addRule(@RequestBody QcRule rule){
        return  qcRuleService.addRule(rule);
    }

    @ApiOperation("修改")
    @PostMapping("/editRule")
    @LogDetail(requestParam ="editRule",operationType = OperationType.UPDATE, module = "质控规则",content = "通过质控规则模块，编辑【name】字典", businessName = "name")
    public Result editRule(@RequestBody QcRule rule) {
        return qcRuleService.editRule(rule);
    }

    @ApiOperation("根据详情id删除详情数据")
    @PostMapping("/deleteRule")
    @LogDetail(requestParam ="deleteRule",operationType = OperationType.DELETE, module = "质控规则",content = "通过质控规则模块，删除【name】数据", businessName = "name")
    public Result deleteRule(@RequestBody QcRule rule) {
        return qcRuleService.deleteRule(rule);
    }


}
